package basica.academico;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="TBDISCIPLINAATIVA")
public class DisciplinaAtiva {
	
	@Id 
    @Column(name="CodDisciplinaAtiva")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer codigo;
	
	@OneToOne
	@JoinColumn(name="CodDisciplina")
	private Disciplina disciplina;
	
	@ManyToOne
	@JoinColumn(name="CodProfessor")
	private Professor professor;
	
	@OneToOne
	@JoinColumn(name="ID_CodTurma")
	private Turma turma;
	
	@Column(name = "Semestre", length = 6, nullable = false)
	private String semestre;
	

	@ManyToMany(fetch=FetchType.LAZY)
	@JoinTable(name="TBGRADEDISCIPLINA", joinColumns=@JoinColumn(name="CodDisciplinaAtiva"),
				inverseJoinColumns=@JoinColumn(name="CodGrade"))
	private Collection<Grade> grade;
	
	public DisciplinaAtiva() {
		super();
		this.professor = new Professor();
		this.turma = new Turma();
		this.disciplina = new Disciplina();
		this.grade = new ArrayList<Grade>();
	}
	
	public Collection<Grade> getGrade() {
		return grade;
	}

	public void setGrade(Collection<Grade> grade) {
		this.grade = grade;
	}

	public Professor getProfessor() {
		return professor;
	}

	public void setProfessor(Professor professor) {
		this.professor = professor;
	}

	public Integer getCodigo() {
		return codigo;
	}
	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}
	public Disciplina getDisciplina() {
		return disciplina;
	}
	public void setDisciplina(Disciplina disciplina) {
		this.disciplina = disciplina;
	}
	public Turma getTurma() {
		return turma;
	}
	public void setTurma(Turma turma) {
		this.turma = turma;
	}

	public String getSemestre() {
		return semestre;
	}

	public void setSemestre(String semestre) {
		this.semestre = semestre;
	}
	
}